import jfRequest from "../../index";
import { IResultType } from "types/request";

// 获取报修类型列表
export function getTypes(status: number) {
  return jfRequest.post<IResultType<any>>({
    url: "/api/v1/equipment/repairConfig/list?status=" + status,
  });
}

// 获取报修类型列表
export function getPlaceTree(status: number) {
  return jfRequest.get<IResultType<any>>({
    url: "/api/v1/common/getPlaceTree",
  });
}

// 获取教室房间
export function getRooms(type: number, buildingId: string) {
  return jfRequest.post<any>({
    url:
      "/api/v1/common/getClassRoomListByPlaceId?type=" +
      type +
      "&buildingId=" +
      buildingId,
    showLoading: false,
  });
}

// 新增报修
export function addRepairs(data: any) {
  return jfRequest.post<IResultType<any>>({
    url: "/api/v1/equipment/repair/add",
    data,
  });
}

// 报修详情
export function getRepairDetail(id: any) {
  return jfRequest.get<IResultType<any>>({
    url: "/api/v1/equipment/repair/detail/" + id,
  });
}

// 维修职工新增维修信息
export function addRepairInfo(data: any) {
  return jfRequest.post<IResultType<any>>({
    url: "/api/v1/equipment/repairResult/add",
    data,
  });
}

// 编辑维修配置
export function editOptionStatus(data: any) {
  return jfRequest.put<IResultType<any>>({
    url: "/api/v1/equipment/repairConfig/edit",
    data,
  });
}

// 编辑维修配置
export function sureRepairStaff(data: any) {
  return jfRequest.post<IResultType<any>>({
    url: "/api/v1/equipment/repair/assign",
    data,
  });
}
